import React, { Component } from "react";
import { Route, Switch, Redirect } from "react-router-dom";
import Home from "./pages/Home"; //一般组件
import About from "./pages/About"; //路由组件
import MyLink from "./compontents/MyLink";
import Header from "./compontents/Header"; //路由组件

// import "./App.css";
export default class App extends Component {
  render() {
    return (
      <div>
        <div className="row">
          <Header></Header>
        </div>
        <div className="row">
          <div className="col-xs-2 col-xs-offset-2">
            <div className="list-group">
              <MyLink to="/about" a={1} b={2}>
                about
              </MyLink>
              <MyLink to="/home">home</MyLink>
              {/* 原生的是靠链接跳转 */}
              {/* <a className="list-group-item active" href="./about.html">
                About
              </a>
              <a className="list-group-item" href="./home.html">
                Home
              </a> */}
            </div>
          </div>
          <div className="col-xs-6">
            <div className="panel">
              <div className="panel-body">
                {/* 注册路由 默认模糊匹配,精准匹配exact*/}
                <Switch>
                  <Route path="/about"  component={About} />
                  <Route path="/home"  component={Home} />
                  <Redirect to="/home"/>
                </Switch>
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }
}
